<template>
    <div class="orderHeader">
        <div class="orderHeaderMain">
            <div class="logo">
                <a href="//www.jd.com" target="_blank" class="fore1"></a>
                <div class="returnHome">
                    <a href="//home.jd.com" target="_self" class="fore2">我的京东</a>
                    <a href="//www.jd.com" target="_blank" class="fore3">返回京东首页</a>
                </div>
                <div class="navItems">
                    <div class="selectPop" v-show="isShowPop" :style="popStyle" @mouseleave="isHiddleUserSetting" @mouseover="isShowUserSetting(currentPop)" v-html="selecItems">
                    </div>
                    <ul>
                        <li>首页</li>
                        <li class="userSetting" @mouseover="isShowUserSetting('userSetting')" @mouseleave="isHiddleUserSetting">
                            账户设置<b></b>
                        </li>
                        <li class="userSetting" @mouseover="isShowUserSetting('recommands')" @mouseleave="isHiddleUserSetting">评价<b></b></li>
                    </ul>
                </div>
            </div>
            <div class="rightArea">
                <div><input type="text" /><button>搜索</button></div>
            </div>
        </div>
    </div>
</template>
<script lang="ts">
    import { Component, Vue } from 'vue-property-decorator'
    import { Action, Getter } from 'vuex-class'
    import logo from '@/components/common/images/logo.png'
    import { namespace } from 'vuex-class';
    import * as _ from 'lodash'
    @Component({
        components: {}
    })
    export default class OrderHeader extends Vue {
        public selecItems: any = "";
        public isShowPop: boolean = false;
        public popStyle: any = "";
        public currentPop: any = "";
        public async created() {

        }
        public getSelectPopStyle(type: any) {
            if (type == 'userSetting') {
                return {
                    top: "60px",
                    left: '110px'
                }
            }
            if (type == "recommands") {
                return {
                    top: "60px",
                    left: '220px'
                }
            }

        }
        public isShowUserSetting(type: any) {
            this.popStyle = this.getSelectPopStyle(type);
            this.currentPop = type;
            if (type == 'userSetting') {
                this.selecItems = `
                  <ul>
                       <li>个人信息</li>
                       <li>账户安全</li>
                       <li>收货地址</li>
                       <li>我的银行卡</li>
                  </ul>
                `;
            }
            if (type == "recommands") {
                this.selecItems = `
                  <ul>
                       <li>待评价</li>
                       <li>服务评价</li>
                       <li>待追评</li>
                       <li>已追评</li>
                  </ul>
                `;
            }
            this.isShowPop = false;
            this.$nextTick(() => {
                this.isShowPop = true;
            });
        }
        public isHiddleUserSetting() {
            this.isShowPop = false;
        }
    }
</script>
<style lang="less">
    .orderHeader {
        width: 100%;
        background-color: white;
        height: 80px;
        background-color: #e2231a;
        display: flex;
        justify-content: center;
        position: relative;

        .orderHeaderMain {
            display: flex;
            justify-content: space-between;
            width: 80%;

            .logo {
                display: flex;

                .fore1 {
                    text-decoration: none;
                    color: red;
                    float: left;
                    margin-right: 10px;
                    width: 158px;
                    height: 80px;
                    background: url(http://120.77.241.102/images/logo_2017.png);
                    display: flex;
                    flex-direction: row;
                }

                .returnHome {
                    display: flex;
                    flex-direction: column;

                    .fore2 {
                        float: left;
                        font-size: 20px;
                        font-family: "Microsoft YaHei";
                        margin: 15px 0 0 6px;
                        height: 22px;
                        color: #fff;
                        text-decoration: none;
                    }

                    .fore3 {
                        float: left;
                        margin: 12px 0 0;
                        color: #ffb2b2;
                        border: 1px solid #ffb2b2;
                        height: 18px;
                        line-height: 18px;
                        padding: 0 10px;
                        border-radius: 10px;
                        text-decoration: none;
                    }
                }

            }

            .navItems {
                display: flex;
                width: 350px;
                margin-left: 20px;
                position: relative;

                .selectPop {
                    background-color: white;
                    position: absolute;
                    background-color: #fff;
                    border: 1px solid #ddd;
                    border-top: 0;
                    font-size: 12px;

                    ul {
                        display: flex;
                        flex-direction: column;
                        margin: 0px;
                        padding: 0px;

                        li {
                            list-style-type: none;
                            padding-left: 10px;
                            padding-right: 20px;
                            padding-top: 5px;
                            padding-bottom: 5px;
                            font-size: 12px;
                            cursor: pointer;
                        }

                        li:hover {
                            background: #f5f5f5;
                            color: #e4393c;
                        }
                    }
                }

                >ul {
                    width: 100%;
                    margin: 0;
                    padding: 0;
                    display: flex;
                    align-items: center;

                    >li {
                        list-style-type: none;
                        flex: 1;
                        display: flex;
                        color: #fff;
                        font-size: 14px;
                        justify-content: center;
                        align-items: center;
                    }

                    >li:nth-child(3) {
                        margin-right: 50px;
                    }

                    .userSetting {
                        height: 40px;

                        b {
                            width: 9px;
                            height: 6px;
                            overflow: hidden;
                            margin-left: 5px;
                            background: url(http://120.77.241.102/images/icon.png) 0 -120px no-repeat;
                        }
                    }
                }
            }

            .rightArea {
                width: 300px;
                display: flex;
                align-items: center;

                button {
                    outline: 0;
                    width: 56px;
                    font-size: 12px;
                    height: 32px;
                    color: #333;
                    background-color: #f7f7f7;
                    cursor: pointer;
                }

                button {
                    border: none;
                }

                input {
                    outline: 0;
                    width: 120px;
                    height: 28px;
                }
            }

        }
    }
</style>